<ui:composition xmlns="http://www.w3.org/1999/xhtml"
                xmlns:ui="http://java.sun.com/jsf/facelets"
                xmlns:h="http://java.sun.com/jsf/html"
                xmlns:f="http://java.sun.com/jsf/core"
                xmlns:a4j="http://richfaces.org/a4j"
                xmlns:rich="http://richfaces.org/rich"
                >
    <style>
        .column {
            width: 410px;
            vertical-align: top;
        }
        .rowc{
            text-align: right
        }
        .center{
            text-align:center;
            align:center;
        }
        .pic{
            margin-bottom: -4px;
            margin-right: 2px;
            border:none;
        }
        .datat{
            width:200px;
            height:300px;
            overflow: scroll;
        }
        .otherjdept{
            height:300px;
            overflow: auto;
        }
    </style>

    <h:form id="form">
        <rich:panel header="公告预览" styleClass="content-hight">
            *选择类别选择查看具体公告
            <h:panelGrid columns="2" width="100%" columnClasses="col1,col2"  id="edit">
                <rich:tree style="width:300px"
                           render="documentTypeInfo"
                           value="#{announce.treenodes}"
                           selectionChangeListener="#{announce.selected2}"
                           var="idocumentType">
                    <rich:treeNode>
                        <h:outputText value="[#{idocumentType.data.id}]#{idocumentType.data.name}" />
                    </rich:treeNode>
                    <a4j:ajax event="click" render="documentTypeInfo,errmessage,editTable"/>
                </rich:tree>
                <h:panelGroup>
                    <h:panelGrid columns="3" id="documentTypeInfo">
                        <h:outputText value="代码："/>
                        <h:outputText value="#{announce.type.id}"/><br/>


                        <h:outputText value="名称："/>
                        <h:outputText  value="#{announce.type.name}"/><br/>

                        <h:outputLabel value="说明："/>
                        <h:outputLabel value="编码命名规则为11-11-11-11-11"/>
                    </h:panelGrid>
                </h:panelGroup>
            </h:panelGrid>

            <br/>

            <hr/>
            <h:panelGroup styleClass="datat">
                <div>
                    <rich:dataTable id="editTable"
                                    value="#{announce.announcelist}"
                                    style="width:100%;"
                                    var="row" rows="10">
                        <rich:column >
                            <f:facet name="header">
                                <h:panelGroup>
                                    <h:outputText value="公告标题"/>
                                </h:panelGroup>
                            </f:facet>
                            <h:commandLink action="#{announce.showContent(row)}">
                                <h:outputText value="#{row.title}"/>
                            </h:commandLink>
                        </rich:column>

                        <rich:column >
                            <f:facet name="header">
                                <h:panelGroup>
                                    <h:outputText value="公告时间"/>
                                </h:panelGroup>
                            </f:facet>
                            <h:outputText value="#{row.createdate}">
                                <f:convertDateTime pattern="yyyy/MM/dd"/>
                            </h:outputText>
                        </rich:column>

                        <rich:column >
                            <f:facet name="header">
                                <h:panelGroup>
                                    <h:outputText value="公告作者"/>
                                </h:panelGroup>
                            </f:facet>
                            <h:outputText value="#{row.author}" style="white-space: nowrap;"/>
                        </rich:column>

                        <rich:column >
                            <f:facet name="header">
                                <h:panelGroup style="white-space: nowrap;">
                                    <h:outputText value="最后修改时间"/>
                                </h:panelGroup>
                            </f:facet>
                            <h:outputText value="#{row.lastchangedate}">
                                <f:convertDateTime pattern="yyyy/MM/dd"/>
                            </h:outputText>
                        </rich:column>

                        <rich:column rendered="false">
                            <f:facet name="header">
                                <h:panelGroup>
                                    <h:outputText value="审核状态"/>
                                </h:panelGroup>
                            </f:facet>
                            <h:outputText  value="已审核" style="color:green" rendered="#{row.auditflag=='1'}"/>
                            <h:outputText  value="未审核" style="color:red" rendered="#{row.auditflag=='0'}"/>
                        </rich:column>

                        <rich:column rendered="false">
                            <f:facet name="header">
                                <h:panelGroup>
                                    <h:outputText value="审核人"/>
                                </h:panelGroup>
                            </f:facet>
                            <h:outputText value="#{row.auditor}"/>
                        </rich:column>

                        <rich:column rendered="false">
                            <f:facet name="header">
                                <h:panelGroup>
                                    <h:outputText value="审核时间"/>
                                </h:panelGroup>
                            </f:facet>
                            <h:outputText value="#{row.auditdate}" rendered="#{row.auditflag=='1'}">
                                <f:convertDateTime pattern="yyyy/MM/dd"/>
                            </h:outputText>
                        </rich:column>

                        <rich:column >
                            <f:facet name="header">
                                <h:panelGroup style="white-space: nowrap;">
                                    <h:outputText value="重要性"/>
                                </h:panelGroup>
                            </f:facet>
                            <h:outputText  value="重要" style="color:red" rendered="#{row.importance=='1'}"/>
                            <h:outputText  value="不重要" style="color:green" rendered="#{row.importance=='0'}"/>
                        </rich:column>

                        <rich:column>
                            <f:facet name="header">
                                <h:panelGroup>
                                    <h:outputText value="附件"/>
                                </h:panelGroup>
                            </f:facet>
                            <h:commandLink rendered="#{row.showflag}" action="#{announce.download(row)}">
                                <h:outputText value="#{row.docname}"  rendered="#{row.showflag}"/>
                            </h:commandLink>
                            <h:outputText value="#{row.docname}[文档已不存在]" rendered="#{!(row.showflag || row.docname==null)}"/>
                        </rich:column>

                        <f:facet name="footer">
                            <rich:dataScroller id="ds"></rich:dataScroller>
                        </f:facet>
                    </rich:dataTable>
                </div>
            </h:panelGroup>
        </rich:panel>
    </h:form>
</ui:composition>
